package Alex.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.*;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class EditMoviePage extends InternalPage {

	public EditMoviePage(PageManager pages) {
		super(pages);
	}
	
  public EditMoviePage ensurePageLoaded() {
    super.ensurePageLoaded();
    wait.until(presenceOfElementLocated(By.cssSelector("a[onclick*='./?go=delete']")));
    return this;
  }
  
  @FindBy(css = "a[onclick*='./?go=delete']")
  private WebElement removeButton;

  @FindBy(css = "a[href*='./?go=edit']")
  private WebElement editButton;
  
  @FindBy(css = "a[href='http://localhost/php4dvd/']")
  private WebElement homeLink;
  
  public InternalPage clickRemovebutton() {
	    removeButton.click();
	    wait.until(alertIsPresent()).accept();
	    return pages.internalPage;
	  }
  public InternalPage clickHomeLink() {
	    homeLink.click();
	    return pages.internalPage;
}
  
}